<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>站内信收件箱</title>
		<meta name="description" content="彰显网络商务价值 实现创新职业梦想" />
		<meta name="keywords" content="互联网,大学生,大赛,电子商务,创业,就业,实践,有奖活动,网络商务,实践,海峡两岸,大学生竞赛,实践教学,高新民,校企合作" />
		<link href="__CSS__/common.css" rel="stylesheet" type="text/css" />
		<link href="__CSS__/Team/Version4Master.css" rel="stylesheet" type="text/css" />
		<script src="__JS__/jquery-1.8.2.js" type="text/javascript"></script>
		<link href="__CSS__/thickbox.css" rel="stylesheet" type="text/css" />
		<link href="__CSS__/mail_new.css" rel="stylesheet" type="text/css" />
	</head>
	<body>
		<iframe name="iframdel" src="" style="display:none;"></iframe>
		<div id="container">
			<include file="./Match/Tpl/Include/header.html" />
			<div class="clear"></div>
			<div id="pp" style="padding-top:20px;">
				<div id="mail">
					<div class="mailtitle">
						<div class="titlename">站内信</div>
						<switch name="Think.session.loginuser.UserType">
							<case value="1" ><a href="__APP__/Student/Home/index/id/{$Think.session.loginuser.UserId}" class="title-button add-msg" style="float:right;">返回个人主页</a></case>
							<case value="2" ><a href="__APP__/Student/Home/index/id/{$Think.session.loginuser.UserId}" class="title-button add-msg" style="float:right;">返回个人主页</a></case>
							<case value="3" ><a href="__APP__/Teacher/Home/index/id/{$Think.session.loginuser.UserId}" class="title-button add-msg" style="float:right;">返回个人主页</a></case>
							<case value="4" ><a href="__APP__/Officer/Home/index/id/{$Think.session.loginuser.UserId}" class="title-button add-msg" style="float:right;">返回个人主页</a></case>
						</switch>
					</div>
					<div class="mailmain">
					
					</div>
				</div>
			</div>
			<div class="clear"></div>
			<include file="./Match/Tpl/Include/footer.html" />
		</div>
		<include file="./Match/Tpl/Include/openwindow.html" />
	</body>
</html>
<script>
	$(function(){
		var act='receivmail';
		$(".mailmain").load("__URL__/"+act);
		$(".mailload").live("click",function(){
			act=$(this).attr("act");
			$(".mailmain").load("__URL__/"+act);
		});
		
		//全选/全不选 
		var chall=false;
		$(".selectall").live("click",function(){
			if(!chall){
				$("input:checkbox").attr("checked",true);
				chall=true;
			}else{
				$("input:checkbox").attr("checked",false);
				chall=false;
			}
		});
		
		//反向选则
		$(".selectfalse").live("click",function(){
			var list = $(":checkbox:checked");
			$(":checkbox").attr("checked",true);
			list.attr("checked",false);
		});
		
		//删除所选
		$(".DeleteBulk").live("click",function(){
			var mhaschecked=ischecked();
			$.ajax({
				type: "POST",
				url: "__URL__/delsome",
				data: "ids="+mhaschecked,
				success: function(num){
					chanmailnul(num,true);
					$(".mailmain").load("__URL__/"+act);
				}
			});
		});
		
		//获取选定
		cklist="";
		function ischecked(){
			var list = $(":checkbox:checked");
			list.each(function(ob){
				cklist+=list[ob].value+',';
			});
			if(cklist==""){
				alert("您还没有选择");
				return false;
			}else{
				return cklist
			}
		}
		
		//标记未读
		$(".dnoread").live("click",function(){
			var dhaschecked=ischecked();
			$.ajax({
				type: "POST",
				url: "__URL__/dnoread",
				data: "ids="+dhaschecked,
				success: function(num){
					chanmailnul(num,true);
					$(".mailmain").load("__URL__/"+act);
				}
			});
		});
		
		//标记已读
		$(".disread").live("click",function(){
			var shaschecked=ischecked();
			$.ajax({
				type: "POST",
				url: "__URL__/disread",
				data: "ids="+shaschecked,
				success: function(num){
					chanmailnul(num,true);
					$(".mailmain").load("__URL__/"+act);
				}
			});
		});
		
	});
	function delcallback(res,id,newnum){
		if(res){
			var obj=$('tr[delid="'+id+'"]');
			chanmailnul(newnum,res)
			obj.remove();
		}else{
			alert("删除失败,请重试。");
		}
	}
	
	function chanmailnul(num,res){
		if(res){
			$(".mailinfo").html(num+' <img src="__IMG__/email.gif" style="border:0;position:relative;top:1px;" />');
		}else{
			$(".mailinfo").html('<img src="__IMG__/email-no.gif" style="border:0;position:relative;top:3px;" />');
		}
	}
	
	function changenew(id){
		var obj=$('tr[delid="'+id+'"]');
		obj.addClass("isread").removeClass("noread");
	}
</script>